// PROGRAMA : IDCPB007(PROGRAMA BATCH - JCL= ABNCACRI)
// BIBLIOTECA : SISP
// OBJETIVO : GERAR ARQUIVO PARA AMERICAN BANK NOTE COMPANY - ABN
// : CRIMINAL
// : USER = RENACHMA
// : PASSWORD = ABN738
// : IP = 100.249.158.131
// OBS : O PROGRAMA IDCPB008 DEVE SER RODADO EM SEGUIDA
// ALTERADO : 31/03/2008
// PDS : PDS.SEJUSP = PDS.SOLON
// JCL : ABNCACRI = IDCPB007
// ARQUIVO(PDS): ABN.CRIM

package br.com.vti.sisp_sicrim.antigo.controller.programa;

import java.io.FileWriter;
import java.io.IOException;

import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.vti.sisp_sicrim.antigo.model.SicCadastro;
import br.com.vti.sisp_sicrim.antigo.util.ExceptionProgram;
import br.com.vti.sisp_sicrim.antigo.util.Sessao;
import br.com.vti.sisp_sicrim.antigo.util.UtilBean;

/**
 * Classe : Idcpb007 OBJETIVO : GERAR ARQUIVO PARA AMERICAN BANK NOTE COMPANY - ABN *
 * 
 * @author Incode - Data: mai/2014
 * 
 */

@Resource
@Path("/antigo/idcpb007")
public class Idcpb007 {
	// Views utilizadas
	SicCadastro sicCadastroView = new SicCadastro();
	// Telas/relatorios utilizados
	// Includes utilizados
	// Areas globais / session // Funcoes/subrotinas
	FuncoesGerais funcoes = new FuncoesGerais();
	FileWriter arquivo1;

	Result result;
	Sessao sessao;
	Boolean primeiraVez = false;
	private String wpoldir;
	private String i1;
	private String winddir;
	private String i2;
	private String wmeddir;
	private String i3;
	private String wanudir;
	private String i4;
	private String wmindir;
	private String i5;
	private String wpolesq;
	private String i6;
	private String windesq;
	private String i7;
	private String wmedesq;
	private String i8;
	private String wanuesq;
	private String i9;
	private String wminesq;
	private String i10;
	private int wstatusReg;
	private String i11;
	private String wtipoReg;
	private String i12;
	private int wnumpos;
	private String i13;
	private long wnupro;
	private String i14;
	private long wregistroEstadualGeral;
	private String i15;
	private long wregistroFederalCi;
	private String i16;
	private String wigUf;
	private String i17;
	private String wnomeCompleto;
	private String i18;
	private String wnomePai;
	private String i19;
	private String wnomeMae;
	private String i20;
	private String wnomeAnterior;
	private String i21;
	private int wdataReg;
	private String i22;
	private String[] wapelidoAlcunhas;
	private String i23;
	private int wdataNasc;
	private String i24;
	private int wcompleicao;
	private String i25;
	private String wufRegEstadualGeral;
	private String i26;
	private String wmunicipioRegGeral;
	private String i27;
	private int wcodMunicRegGeral;
	private String i28;
	private String wdocumApresentado;
	private String i29;
	private long wnumeDocumApresent;
	private String i30;
	private String worgaoExpUf;
	private String i31;
	private int wnacionalidadeEstrangeiro;
	private String i32;
	private int wtipoProprietarioArma;
	private String i33;
	private String wdataUltimaMovimentUf;
	private String i34;
	private String wpossuiInquerito;
	private String i35;
	private String wpossuiArma;
	private String i36;
	private String wpossuiProcesso;
	private String i37;
	private String wfalecido;
	private String i38;
	private String wpossuiMandatoPAberto;
	private String i39;
	private String worgaoExp;
	private String i40;
	private String wufExp;
	private String i41;
	private String wnomeDelegacia;
	private String i42;
	private int wsexo;
	private String i43;
	private int wcutis;
	private String i44;
	private int wcorCabelos;
	private String i45;
	private int wtipoCabelos;
	private String i46;
	private int wcorOlhos;
	private String i47;
	private int wsobrancelhas;
	private String i48;
	private int wbarba;
	private String i49;
	private int wbigode;
	private String i50;
	private int waltura;
	private String i51;
	private String wmarcaPartCicatTatuag;
	private String i52;
	private String wprofissao;
	private String i53;
	private int westatoCivil;
	private String i54;
	private int wnacionalidade;
	private String i55;
	private String wnaturalidade;
	private String i56;
	private int wcodMunicipioNascimento;
	private String i57;
	private String wufNaturalidade;
	private String i58;
	private int wgrauInstrucao;
	private String i59;
	private String wavRua;
	private String i60;
	private int wnumero;
	private String i61;
	private String wbairro;
	private String i62;
	private int wmunicipio;
	private String i63;
	private String westado;
	private String i64;
	private int wcep;
	private String i65;
	private String wcomplemento;
	private String i66;
	private String wmotivoPrisaoLei;
	private String i67;
	private long wnumeroAutos;
	private String i68;
	private int wanoAutos;
	private String i69;
	private int wdataAtuacao;
	private String i70;
	private String whoraPrisao;
	private String i71;
	private String wnomeVitima;
	private String i72;
	private String wlocal;
	private String i73;
	private String whaInqueritoPolic;
	private String i74;
	private String wquerFolhaAnteced;
	private String i75;
	private int wmatfuncAtu;
	private String i76;
	private int wdatdocAtu;
	private String i77;
	private int whoraAtu;
	private String i78;
	private String wregistroOutrosEstados;
	private String wregCrim; // END

	private int i;
	private int c = 0;

	// 42.053 REGISTROS GRAVADOS ATE 10/07/2003 AS 20:00 NO SIC-CADASTRO
	// REGISTROS GRAVADOS ATE 26/02/2005 AS 20:00 NO SIC-CADASTRO

	// READ SIC-CADASTRO-VIEW BY DATDOC-ATU STARTING FROM 20030723

	public Idcpb007(Result result, Sessao sessao) {
		this.result = result;
		this.sessao = sessao;
	}

	@Post
	public void executar() {
		try {
			main();
		} catch (Exception e) {
			ExceptionProgram excp = new ExceptionProgram();
			excp.trataErro(e, sessao, this.getClass().getSimpleName());
		}
	}

	private void main() throws IOException {
		arquivo1 = new FileWriter(UtilBean.pathFiles() + "arquivo1");

		while (sicCadastroView.leitura()) {
			// READADA
			wregCrim = "";
			// MOVE
			i10 = "#";
			i11 = "#";
			i12 = "#";
			i13 = "#";
			i14 = "#";
			i15 = "#";
			i16 = "#";
			i17 = "#";
			i18 = "#";
			i19 = "#";
			i1 = "#";
			i20 = "#";
			i21 = "#";
			i22 = "#";
			i23 = "#";
			i24 = "#";
			i25 = "#";
			i26 = "#";
			i27 = "#";
			i28 = "#";
			i29 = "#";
			i2 = "#";
			i30 = "#";
			i31 = "#";
			i32 = "#";
			i33 = "#";
			i34 = "#";
			i35 = "#";
			i36 = "#";
			i37 = "#";
			i38 = "#";
			i39 = "#";
			i3 = "#";
			i40 = "#";
			i41 = "#";
			i42 = "#";
			i43 = "#";
			i44 = "#";
			i45 = "#";
			i46 = "#";
			i47 = "#";
			i48 = "#";
			i49 = "#";
			i4 = "#";
			i50 = "#";
			i51 = "#";
			i52 = "#";
			i53 = "#";
			i54 = "#";
			i55 = "#";
			i56 = "#";
			i57 = "#";
			i58 = "#";
			i59 = "#";
			i5 = "#";
			i60 = "#";
			i61 = "#";
			i62 = "#";
			i63 = "#";
			i64 = "#";
			i65 = "#";
			i66 = "#";
			i67 = "#";
			i68 = "#";
			i69 = "#";
			i6 = "#";
			i70 = "#";
			i71 = "#";
			i72 = "#";
			i73 = "#";
			i74 = "#";
			i75 = "#";
			i76 = "#";
			i77 = "#";
			i78 = "#";
			i7 = "#";
			i8 = "#";
			i9 = "#";
			i = 0;
			for (i = 1; i <= 4; i++) {
				if (sicCadastroView.getApelidoAlcunhas(i).trim().equals("")) {
					break;
				} else {
					wapelidoAlcunhas[i] = sicCadastroView.getApelidoAlcunhas(i);
				}

			}
			wpoldir = sicCadastroView.getPolegarDireito();
			winddir = sicCadastroView.getIndicadorDireito();
			wmeddir = sicCadastroView.getMedioDireito();
			wanudir = sicCadastroView.getAnularDireito();
			wmindir = sicCadastroView.getMinimoDireito();
			wpolesq = sicCadastroView.getPolegarEsquerdo();
			windesq = sicCadastroView.getIndicadorEsquerdo();
			wmedesq = sicCadastroView.getMedioEsquerdo();
			wanuesq = sicCadastroView.getAnularEsquerdo();
			wminesq = sicCadastroView.getMinimoEsquerdo();
			wstatusReg = sicCadastroView.getStatusReg();
			wtipoReg = sicCadastroView.getTipoReg();
			wnumpos = sicCadastroView.getNumPos();
			wnupro = sicCadastroView.getNupro();
			wregistroEstadualGeral = sicCadastroView.getRegEstadualGeral();
			wregistroFederalCi = sicCadastroView.getRegFederalCi();
			wigUf = sicCadastroView.getIgUf();
			wnomeCompleto = sicCadastroView.getNomeCompleto();
			wnomePai = sicCadastroView.getNomePai();
			wnomeMae = sicCadastroView.getNomeMae();
			wnomeAnterior = sicCadastroView.getNomeAnterior();
			wdataReg = sicCadastroView.getDataReg();
			wdataNasc = sicCadastroView.getDataNasc();
			wcompleicao = sicCadastroView.getCompleicao();
			wufRegEstadualGeral = sicCadastroView.getUfRegEstadualGeral();
			wmunicipioRegGeral = sicCadastroView.getMunicipioRegGeral();
			wcodMunicRegGeral = sicCadastroView.getCodigoMunicipioRegGeral();
			wdocumApresentado = sicCadastroView.getDocumentoApresent();
			worgaoExpUf = sicCadastroView.getOrgaoExpUfUfUf();
			wnacionalidadeEstrangeiro = sicCadastroView.getNacionEstrangeiro();
			wtipoProprietarioArma = sicCadastroView.getTipoProprietarioArma();
			wdataUltimaMovimentUf = sicCadastroView.getDataUltimaMovimentUf();
			wpossuiInquerito = sicCadastroView.getPossuiInquerito();
			wpossuiArma = sicCadastroView.getPossuiArma();
			wpossuiProcesso = sicCadastroView.getPossuiProcesso();
			wfalecido = sicCadastroView.getFalecido();
			wpossuiMandatoPAberto = sicCadastroView.getPossuiMandatoAberto();
			worgaoExp = sicCadastroView.getOrgaoExp();
			wufExp = sicCadastroView.getUfExp();
			wnomeDelegacia = sicCadastroView.getNomeDelegacia();
			wsexo = sicCadastroView.getSexo();
			wcutis = sicCadastroView.getCodigoCutis();
			wcorCabelos = sicCadastroView.getCodigoCorCabelo();
			wtipoCabelos = sicCadastroView.getCodigoTipoCabelo();
			wcorOlhos = sicCadastroView.getCodigoCorOlhos();
			wsobrancelhas = sicCadastroView.getCodigoSobrancelhas();
			wbarba = sicCadastroView.getCodigoBarba();
			wbigode = sicCadastroView.getCodigoBigode();
			waltura = sicCadastroView.getAltura();
			wmarcaPartCicatTatuag = sicCadastroView.getMarcaPartCicatTatuag();
			wprofissao = sicCadastroView.getProfissao();
			westatoCivil = sicCadastroView.getEstadoCivil();
			wnacionalidade = sicCadastroView.getNacionalidade();
			wnaturalidade = sicCadastroView.getNaturalidade();
			wcodMunicipioNascimento = sicCadastroView.getCodigoMunicipioNasc();
			wufNaturalidade = sicCadastroView.getUfNaturalidade();
			wgrauInstrucao = sicCadastroView.getGrauInstrucao();
			wavRua = sicCadastroView.getAvRua();
			wnumero = sicCadastroView.getNumero();
			wbairro = sicCadastroView.getBairro();
			wmunicipio = sicCadastroView.getMunicipio();
			westado = sicCadastroView.getEstado();
			wcep = sicCadastroView.getCep();
			wcomplemento = sicCadastroView.getComplemento();
			wmotivoPrisaoLei = sicCadastroView.getMotivoPrisaoLei();
			wdataAtuacao = sicCadastroView.getDataAtuacao();
			whoraPrisao = sicCadastroView.getHoraPrisao();
			wnomeVitima = sicCadastroView.getNomeVitima();
			wlocal = sicCadastroView.getLocal();
			whaInqueritoPolic = sicCadastroView.getInqueritoPolicial();
			wquerFolhaAnteced = sicCadastroView.getQuerFolhaAnteced();
			wmatfuncAtu = sicCadastroView.getMatriculaFuncAtu();
			wdatdocAtu = sicCadastroView.getDataDocAtu();
			whoraAtu = sicCadastroView.getHoraAtu();
			wregistroOutrosEstados = sicCadastroView.getRegOutrosEstados();
			wregCrim = UtilBean.moveSubstring(wregCrim, 0, 7, "A", wpoldir);
			wregCrim = UtilBean.moveSubstring(wregCrim, 7, 1, "A", i1);
			wregCrim = UtilBean.moveSubstring(wregCrim, 8, 7, "A", winddir);
			wregCrim = UtilBean.moveSubstring(wregCrim, 15, 1, "A", i2);
			wregCrim = UtilBean.moveSubstring(wregCrim, 16, 7, "A", wmeddir);
			wregCrim = UtilBean.moveSubstring(wregCrim, 23, 1, "A", i3);
			wregCrim = UtilBean.moveSubstring(wregCrim, 24, 7, "A", wanudir);
			wregCrim = UtilBean.moveSubstring(wregCrim, 31, 1, "A", i4);
			wregCrim = UtilBean.moveSubstring(wregCrim, 32, 7, "A", wmindir);
			wregCrim = UtilBean.moveSubstring(wregCrim, 39, 1, "A", i5);
			wregCrim = UtilBean.moveSubstring(wregCrim, 40, 7, "A", wpolesq);
			wregCrim = UtilBean.moveSubstring(wregCrim, 47, 1, "A", i6);
			wregCrim = UtilBean.moveSubstring(wregCrim, 48, 7, "A", windesq);
			wregCrim = UtilBean.moveSubstring(wregCrim, 55, 1, "A", i7);
			wregCrim = UtilBean.moveSubstring(wregCrim, 56, 7, "A", wmedesq);
			wregCrim = UtilBean.moveSubstring(wregCrim, 63, 1, "A", i8);
			wregCrim = UtilBean.moveSubstring(wregCrim, 64, 7, "A", wanuesq);
			wregCrim = UtilBean.moveSubstring(wregCrim, 71, 1, "A", i9);
			wregCrim = UtilBean.moveSubstring(wregCrim, 72, 7, "A", wminesq);
			wregCrim = UtilBean.moveSubstring(wregCrim, 79, 1, "A", i10);
			wregCrim = UtilBean.moveSubstring(wregCrim, 80, 1, "N", wstatusReg);
			wregCrim = UtilBean.moveSubstring(wregCrim, 81, 1, "A", i11);
			wregCrim = UtilBean.moveSubstring(wregCrim, 82, 2, "A", wtipoReg);
			wregCrim = UtilBean.moveSubstring(wregCrim, 84, 1, "A", i12);
			wregCrim = UtilBean.moveSubstring(wregCrim, 85, 3, "N", wnumpos);
			wregCrim = UtilBean.moveSubstring(wregCrim, 88, 1, "A", i13);
			wregCrim = UtilBean.moveSubstring(wregCrim, 89, 9, "N", wnupro);
			wregCrim = UtilBean.moveSubstring(wregCrim, 98, 1, "A", i14);
			wregCrim = UtilBean.moveSubstring(wregCrim, 99, 11, "N", wregistroEstadualGeral);
			wregCrim = UtilBean.moveSubstring(wregCrim, 110, 1, "A", i15);
			wregCrim = UtilBean.moveSubstring(wregCrim, 111, 11, "N", wregistroFederalCi);
			wregCrim = UtilBean.moveSubstring(wregCrim, 122, 1, "A", i16);
			wregCrim = UtilBean.moveSubstring(wregCrim, 123, 20, "A", wigUf);
			wregCrim = UtilBean.moveSubstring(wregCrim, 143, 1, "A", i17);
			wregCrim = UtilBean.moveSubstring(wregCrim, 144, 60, "A", wnomeCompleto);
			wregCrim = UtilBean.moveSubstring(wregCrim, 204, 1, "A", i18);
			wregCrim = UtilBean.moveSubstring(wregCrim, 205, 60, "A", wnomePai);
			wregCrim = UtilBean.moveSubstring(wregCrim, 265, 1, "A", i19);
			wregCrim = UtilBean.moveSubstring(wregCrim, 266, 60, "A", wnomeMae);
			wregCrim = UtilBean.moveSubstring(wregCrim, 326, 1, "A", i20);
			wregCrim = UtilBean.moveSubstring(wregCrim, 327, 60, "A", wnomeAnterior);
			wregCrim = UtilBean.moveSubstring(wregCrim, 387, 1, "A", i21);
			wregCrim = UtilBean.moveSubstring(wregCrim, 388, 8, "N", wdataReg);
			wregCrim = UtilBean.moveSubstring(wregCrim, 396, 1, "A", i22);
			wregCrim = UtilBean.moveSubstring(wregCrim, 397, 30, "A", wapelidoAlcunhas);
			wregCrim = UtilBean.moveSubstring(wregCrim, 427, 1, "A", i23);
			wregCrim = UtilBean.moveSubstring(wregCrim, 428, 8, "N", wdataNasc);
			wregCrim = UtilBean.moveSubstring(wregCrim, 436, 1, "A", i24);
			wregCrim = UtilBean.moveSubstring(wregCrim, 437, 2, "N", wcompleicao);
			wregCrim = UtilBean.moveSubstring(wregCrim, 439, 1, "A", i25);
			wregCrim = UtilBean.moveSubstring(wregCrim, 440, 2, "A", wufRegEstadualGeral);
			wregCrim = UtilBean.moveSubstring(wregCrim, 442, 1, "A", i26);
			wregCrim = UtilBean.moveSubstring(wregCrim, 443, 30, "A", wmunicipioRegGeral);
			wregCrim = UtilBean.moveSubstring(wregCrim, 473, 1, "A", i27);
			wregCrim = UtilBean.moveSubstring(wregCrim, 474, 4, "N", wcodMunicRegGeral);
			wregCrim = UtilBean.moveSubstring(wregCrim, 478, 1, "A", i28);
			wregCrim = UtilBean.moveSubstring(wregCrim, 479, 30, "A", wdocumApresentado);
			wregCrim = UtilBean.moveSubstring(wregCrim, 509, 1, "A", i29);
			wregCrim = UtilBean.moveSubstring(wregCrim, 510, 11, "N", wnumeDocumApresent);
			wregCrim = UtilBean.moveSubstring(wregCrim, 521, 1, "A", i30);
			wregCrim = UtilBean.moveSubstring(wregCrim, 522, 15, "A", worgaoExpUf);
			wregCrim = UtilBean.moveSubstring(wregCrim, 537, 1, "A", i31);
			wregCrim = UtilBean.moveSubstring(wregCrim, 538, 4, "N", wnacionalidadeEstrangeiro);
			wregCrim = UtilBean.moveSubstring(wregCrim, 542, 1, "A", i32);
			wregCrim = UtilBean.moveSubstring(wregCrim, 543, 2, "N", wtipoProprietarioArma);
			wregCrim = UtilBean.moveSubstring(wregCrim, 545, 1, "A", i33);
			wregCrim = UtilBean.moveSubstring(wregCrim, 546, 8, "A", wdataUltimaMovimentUf);
			wregCrim = UtilBean.moveSubstring(wregCrim, 554, 1, "A", i34);
			wregCrim = UtilBean.moveSubstring(wregCrim, 555, 1, "A", wpossuiInquerito);
			wregCrim = UtilBean.moveSubstring(wregCrim, 556, 1, "A", i35);
			wregCrim = UtilBean.moveSubstring(wregCrim, 557, 1, "A", wpossuiArma);
			wregCrim = UtilBean.moveSubstring(wregCrim, 558, 1, "A", i36);
			wregCrim = UtilBean.moveSubstring(wregCrim, 559, 1, "A", wpossuiProcesso);
			wregCrim = UtilBean.moveSubstring(wregCrim, 560, 1, "A", i37);
			wregCrim = UtilBean.moveSubstring(wregCrim, 561, 1, "A", wfalecido);
			wregCrim = UtilBean.moveSubstring(wregCrim, 562, 1, "A", i38);
			wregCrim = UtilBean.moveSubstring(wregCrim, 563, 1, "A", wpossuiMandatoPAberto);
			wregCrim = UtilBean.moveSubstring(wregCrim, 564, 1, "A", i39);
			wregCrim = UtilBean.moveSubstring(wregCrim, 565, 15, "A", worgaoExp);
			wregCrim = UtilBean.moveSubstring(wregCrim, 580, 1, "A", i40);
			wregCrim = UtilBean.moveSubstring(wregCrim, 581, 2, "A", wufExp);
			wregCrim = UtilBean.moveSubstring(wregCrim, 583, 1, "A", i41);
			wregCrim = UtilBean.moveSubstring(wregCrim, 584, 30, "A", wnomeDelegacia);
			wregCrim = UtilBean.moveSubstring(wregCrim, 614, 1, "A", i42);
			wregCrim = UtilBean.moveSubstring(wregCrim, 615, 1, "N", wsexo);
			wregCrim = UtilBean.moveSubstring(wregCrim, 616, 1, "A", i43);
			wregCrim = UtilBean.moveSubstring(wregCrim, 617, 1, "N", wcutis);
			wregCrim = UtilBean.moveSubstring(wregCrim, 618, 1, "A", i44);
			wregCrim = UtilBean.moveSubstring(wregCrim, 619, 1, "N", wcorCabelos);
			wregCrim = UtilBean.moveSubstring(wregCrim, 620, 1, "A", i45);
			wregCrim = UtilBean.moveSubstring(wregCrim, 621, 1, "N", wtipoCabelos);
			wregCrim = UtilBean.moveSubstring(wregCrim, 622, 1, "A", i46);
			wregCrim = UtilBean.moveSubstring(wregCrim, 623, 1, "N", wcorOlhos);
			wregCrim = UtilBean.moveSubstring(wregCrim, 624, 1, "A", i47);
			wregCrim = UtilBean.moveSubstring(wregCrim, 625, 1, "N", wsobrancelhas);
			wregCrim = UtilBean.moveSubstring(wregCrim, 626, 1, "A", i48);
			wregCrim = UtilBean.moveSubstring(wregCrim, 627, 1, "N", wbarba);
			wregCrim = UtilBean.moveSubstring(wregCrim, 628, 1, "A", i49);
			wregCrim = UtilBean.moveSubstring(wregCrim, 629, 1, "N", wbigode);
			wregCrim = UtilBean.moveSubstring(wregCrim, 630, 1, "A", i50);
			wregCrim = UtilBean.moveSubstring(wregCrim, 631, 1, "N", waltura);
			wregCrim = UtilBean.moveSubstring(wregCrim, 632, 1, "A", i51);
			wregCrim = UtilBean.moveSubstring(wregCrim, 633, 60, "A", wmarcaPartCicatTatuag);
			wregCrim = UtilBean.moveSubstring(wregCrim, 693, 1, "A", i52);
			wregCrim = UtilBean.moveSubstring(wregCrim, 694, 30, "A", wprofissao);
			wregCrim = UtilBean.moveSubstring(wregCrim, 724, 1, "A", i53);
			wregCrim = UtilBean.moveSubstring(wregCrim, 725, 1, "N", westatoCivil);
			wregCrim = UtilBean.moveSubstring(wregCrim, 726, 1, "A", i54);
			wregCrim = UtilBean.moveSubstring(wregCrim, 727, 2, "N", wnacionalidade);
			wregCrim = UtilBean.moveSubstring(wregCrim, 729, 1, "A", i55);
			wregCrim = UtilBean.moveSubstring(wregCrim, 730, 35, "A", wnaturalidade);
			wregCrim = UtilBean.moveSubstring(wregCrim, 765, 1, "A", i56);
			wregCrim = UtilBean.moveSubstring(wregCrim, 766, 4, "N", wcodMunicipioNascimento);
			wregCrim = UtilBean.moveSubstring(wregCrim, 770, 1, "A", i57);
			wregCrim = UtilBean.moveSubstring(wregCrim, 771, 2, "A", wufNaturalidade);
			wregCrim = UtilBean.moveSubstring(wregCrim, 773, 1, "A", i58);
			wregCrim = UtilBean.moveSubstring(wregCrim, 774, 1, "N", wgrauInstrucao);
			wregCrim = UtilBean.moveSubstring(wregCrim, 775, 1, "A", i59);
			wregCrim = UtilBean.moveSubstring(wregCrim, 776, 30, "A", wavRua);
			wregCrim = UtilBean.moveSubstring(wregCrim, 806, 1, "A", i60);
			wregCrim = UtilBean.moveSubstring(wregCrim, 807, 8, "N", wnumero);
			wregCrim = UtilBean.moveSubstring(wregCrim, 815, 1, "A", i61);
			wregCrim = UtilBean.moveSubstring(wregCrim, 816, 20, "A", wbairro);
			wregCrim = UtilBean.moveSubstring(wregCrim, 836, 1, "A", i62);
			wregCrim = UtilBean.moveSubstring(wregCrim, 837, 4, "N", wmunicipio);
			wregCrim = UtilBean.moveSubstring(wregCrim, 841, 1, "A", i63);
			wregCrim = UtilBean.moveSubstring(wregCrim, 842, 2, "A", westado);
			wregCrim = UtilBean.moveSubstring(wregCrim, 844, 1, "A", i64);
			wregCrim = UtilBean.moveSubstring(wregCrim, 845, 8, "N", wcep);
			wregCrim = UtilBean.moveSubstring(wregCrim, 853, 1, "A", i65);
			wregCrim = UtilBean.moveSubstring(wregCrim, 854, 20, "A", wcomplemento);
			wregCrim = UtilBean.moveSubstring(wregCrim, 874, 1, "A", i66);
			wregCrim = UtilBean.moveSubstring(wregCrim, 875, 60, "A", wmotivoPrisaoLei);
			wregCrim = UtilBean.moveSubstring(wregCrim, 935, 1, "A", i67);
			wregCrim = UtilBean.moveSubstring(wregCrim, 936, 11, "N", wnumeroAutos);
			wregCrim = UtilBean.moveSubstring(wregCrim, 947, 1, "A", i68);
			wregCrim = UtilBean.moveSubstring(wregCrim, 948, 4, "N", wanoAutos);
			wregCrim = UtilBean.moveSubstring(wregCrim, 952, 1, "A", i69);
			wregCrim = UtilBean.moveSubstring(wregCrim, 953, 8, "N", wdataAtuacao);
			wregCrim = UtilBean.moveSubstring(wregCrim, 961, 1, "A", i70);
			wregCrim = UtilBean.moveSubstring(wregCrim, 962, 8, "A", whoraPrisao);
			wregCrim = UtilBean.moveSubstring(wregCrim, 970, 1, "A", i71);
			wregCrim = UtilBean.moveSubstring(wregCrim, 971, 60, "A", wnomeVitima);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1031, 1, "A", i72);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1032, 30, "A", wlocal);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1062, 1, "A", i73);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1063, 1, "A", whaInqueritoPolic);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1064, 1, "A", i74);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1065, 1, "A", wquerFolhaAnteced);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1066, 1, "A", i75);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1067, 7, "N", wmatfuncAtu);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1074, 1, "A", i76);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1075, 8, "N", wdatdocAtu);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1083, 1, "A", i77);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1084, 8, "N", whoraAtu);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1092, 1, "A", i78);
			wregCrim = UtilBean.moveSubstring(wregCrim, 1093, 20, "A", wregistroOutrosEstados);
			arquivo1.write(wregCrim);
			c += 1;
		}
		sicCadastroView.fecha();
		if (sicCadastroView.registrosProcessados() == 0) {
			UtilBean.mensagemTexto("#ERRO LEITURA: REGISTRO NAO ENCONTRADO NO SIC-CADASTRO");
		}

		UtilBean.mensagemTexto("*** TOTAL DE REGISTROS GERADOS NO CRIMINAL = " + String.valueOf(c));
		arquivo1.close();
	}

}
